package com.nativetalk.dao;

import com.nativetalk.bean.TdNtMembInvitation;
import com.nativetalk.bean.member.*;
import com.nativetalk.bean.rongyun.UserCommit;
import org.apache.ibatis.annotations.Param;

import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
import java.util.Map;

@MyBatisRepository
public interface TdNtMemberDao {
	/**
	 * @Purpose  添加用户
	 * @version  1.0
	 * @author   lizhun
	 * @param    tdNtMemberRegister
	 * @return   void
	 */
	public void insertTdNtMember(TdNtMemberRegister tdNtMemberRegister);
	/**
	 * @Purpose  根据手机号查找用户(用于注册 只查询id)
	 * @version  1.0
	 * @author   lizhun
	 * @param    memb_phone
	 * @return   void
	 */
	public TdNtMemberRegisterSms findTdNtMemberRegisterSms(String memb_phone);
	/**
	 * @Purpose  根据邀请码查找用户(用于查看邀请码是否正确 只查询id,余额)
	 * @version  1.0
	 * @author   lizhun
	 * @param    invite_code
	 * @return   TdNtMemberInvite
	 */
	public TdNtMemberInvite findTdNtMemberInvite(String invite_code);
	/**
	 * @Purpose  根据用户id更新用户余额
	 * @version  1.0
	 * @author   lizhun
	 * @param    tdNtMemberInvite
	 * @return   void
	 */
	public void updateTdNtMemberBalance(TdNtMemberInvite tdNtMemberInvite);
	/**
	 * @Purpose  根据用户id更新用户token
	 * @version  1.0
	 * @author   lizhun
	 * @param    tdNtMemberToken
	 * @return   void
	 */
	public void updateTdNtMemberToken(TdNtMemberToken tdNtMemberToken);
	/**
	 * @Purpose  根据用户手机号查找用户信息
	 * @version  1.0
	 * @author   lizhun
	 * @param    memb_phone
	 * @return   TdNtMember
	 */
    public TdNtMember findTdNtMemberByPhone(String memb_phone);

    /**
	 * @Purpose  根据用户手机号查找用户token,id及密码
	 * @version  1.0
	 * @author   lizhun
	 * @param    memb_phone
	 * @return   TdNtMemberRetrievePsd
	 */
	public TdNtMemberRetrievePsd findTdNtMemberRetrievePsd(String memb_phone);
	/**
	 * @Purpose  根据用户id更新用户token及密码
	 * @version  1.0
	 * @author   lizhun
	 * @param    tdNtMemberRetrievePsd
	 * @return   void
	 */
	public void updateTdNtMemberRetrievePsd(TdNtMemberRetrievePsd tdNtMemberRetrievePsd);
	/**
	 * @Purpose  根据用户id更新用户个人资料
	 * @version  1.0
	 * @author   lizhun
	 * @param    tdNtMember
	 * @return   void
	 */
	public void updateTdNtMemberData(TdNtMember tdNtMember);
	/**
	 * @Purpose  根据用户id查找用户余额
	 * @version  1.0
	 * @author   lizhun
	 * @param    memb_id
	 * @return   BigDecimal
	 */
	public BigDecimal findTdNtMemberBalabce(Integer memb_id);

	/**
	 * @param memb_id
	 * @return TdNtMember
	 * @Purpose 根据用户id查找用户
	 * @version 4.1
	 * @author peter
	 */
	public TdNtMember findMember(Integer memb_id);

	/**
	 * @Purpose  根据用户id查找用户
	 * @version  1.0
	 * @author   lizhun
	 * @param    memb_id
	 * @return   TdNtMemberDetail
	 */
	public TdNtMemberDetail findTdNtMemberDetail(Integer memb_id);

	/**
	 * @Purpose  根据用户id查找用户
	 * @version  1.0
	 * @author   lizhun
	 * @param    memb_id
	 * @return   TdNtMemberDetail
	 */
	public TdNtMemberDetailOrders findTdNtMemberDetailOrders(Integer memb_id);
	/**
	 * @Purpose  根据用户id邀请的用户数量
	 * @version  1.0
	 * @author   wuyuanhui
	 * @param    memb_id
	 * @return   int
	 */
	public int findInviteSize(int memb_id);
	/**
	 * @Purpose  插入邀请记录
	 * @version  1.0
	 * @author   wuyuanhui
	 * @param    tdNtMembInvitation
	 */
	public void insertInvit(TdNtMembInvitation tdNtMembInvitation);
	/**
	 * @Purpose  根据用户id 查找用户学习时间
	 * @version  2.0
	 * @author   lizhun
	 * @param    memb_id
	 * @return   TdNtMemberStudyTimes
	 */
	public TdNtMemberStudyTimes findTdNtMemberStudyTimes(int memb_id);
	/**
	 * @Purpose  根据用户id更新用户学习时间
	 * @version  2.0
	 * @author   lizhun
	 * @param    tdNtMemberStudyTimes
	 * @return   void
	 */
	public void updateTdNtMemberStudyTimes(TdNtMemberStudyTimes tdNtMemberStudyTimes);
	/**
	 * @Purpose  根据用户id更新视频开关
	 * @version  2.0
	 * @author   lizhun
	 * @param    tdNtMember
	 * @return   void
	 */
	public void updatevideoswitch(TdNtMember tdNtMember);

	/**
	 * @Purpose  根据第三方token查找用户信息
	 * @version  4.1
	 * @author   lizhun
	 * @modifier wangzheng
	 * @param    third_token
	 * @return   TdNtMember
	 */
	public TdNtMember findTdNtMemberByThirdToken(String third_token);

	/**
	 * @Purpose  根据第三方token查找用户信息
	 * @version  4.1
	 * @author   lizhun
	 * @modifier wangzheng
	 * @param    third_token
	 * @param    nowLoginType
	 * @return   TdNtMember
	 */
	public TdNtMember findTdNtMemberByLoginTypeAndThirdToken(@Param("third_token")String third_token,@Param("nowLoginType")int nowLoginType);

	/**
	 * @Purpose  根据token查找用户信息
	 * @version  4.1
	 * @author   wangzheng
	 * @param    token
	 * @return   TdNtMember
	 */
	public TdNtMember findTdNtMemberByToken(String token);

	/**
	 * @Purpose  更新用户手机号
	 * @version  2.0
	 * @author   lizhun
	 * @param    tdNtMember
	 * @return   void
	 */
	public void updateMemberPhone(TdNtMember tdNtMember);
	/**
	 * @Purpose  更新用户内购余额
	 * @version  3.1
	 * @author   lizhun
	 * @param    tdNtMember
	 * @return   void
	 */
	public void updateMemberPurchase(TdNtMemberDetail tdNtMember);
	/**
	 * @Purpose  查找用户领取奖励总额
	 * @version  3.2
	 * @author   lizhun
	 * @param    memb_id
	 * @return   BigDecimal
	 */
	public BigDecimal findMemberTotalReward(int memb_id);
	/**
	 * @Purpose  更新用户领取奖励总额
	 * @version  3.2
	 * @author   lizhun
	 * @param    map
	 * @return   void
	 */
	public void updateMemberTotalReward(Map<String,Object> map);
	/**
	 * @Purpose  查找用户打卡次数
	 * @version  3.2
	 * @author   lizhun
	 * @param    memb_id
	 * @return   int
	 */
	public TdNtMemberClcokIn findMemberClockInDay(int memb_id);
	/**
	 * @Purpose  更新用户打卡次数
	 * @version  3.2
	 * @author   lizhun
	 * @param    tdNtMemberClcokIn
	 * @return   void
	 */
	public void updateMemberClockInDay(TdNtMemberClcokIn tdNtMemberClcokIn);
	/**
	 * @Purpose  查找用户推送相关及手机号码
	 * @version  4.0
	 * @author   lizhun
	 * @param    memb_id
	 * @return   TdNtMemberTuisong
	 */
	public TdNtMemberTuisong findTdNtMemberTuisong(int memb_id);

	/**
	 * @Purpose 更新学生的设备ID和设备类型
	 * @version 4.1
	 * @author Peter
	 */
	public void updateEquClientIdByMembId(@Param("memb_id") int memb_id, @Param("equ_client_id") String equ_client_id, @Param("equ_type") String equ_type);

	/**
	 * @Purpose  获取用户绑定信息
	 * @version  4.1
	 * @author   wangzheng
	 * @param    memb_id
	 * @return   TdNtMemberBindInfo
	 */
	public TdNtMemberBindInfo findMemberBindStatusByMembId(int memb_id);

	/**
	 * @Purpose  更新用户绑定的第三方账号情况
	 * @version  4.1
	 * @author   wangzheng
	 * @param    map
	 */
	public void updateMemberThirdPartyBindStatus(Map<String,Object> map);

	/**
	 * @Purpose  根据用户id更新用户信息
	 * @version  4.1
	 * @author   wangzheng
	 * @param    tdNtMemberToken
	 * @return   void
	 */
	public void updateTdNtMemberInfo(TdNtMemberToken tdNtMemberToken);

	void updateMemberJustTalkUserUri(@Param("memb_id") Integer memb_id, @Param("justTalkUserUri") String justTalkUserUri);

	public List<UserCommit> selectUsersRongCloud();

	public UserCommit selectStudentMessageById(@Param("memb_id") Integer memb_id);

	public void updateRongCloudToken(@Param("rongcloud_token")String rongcloud_token,@Param("memb_id")Integer memb_id);

	/**
	 * 根据用户ID修改用户生日
	 * @param memb_birthday
	 * @param memb_id
	 */
	public void updateBirthdayByMembId(@Param("memb_birthday") Date memb_birthday, @Param("memb_id") Integer memb_id);
}
